package cn.mesmile.shiro.module.jwt;

import cn.mesmile.shiro.utils.JwtUtil;
import org.apache.shiro.authc.AuthenticationToken;

/**
 * 封装token
 */
public class JwtToken implements AuthenticationToken {

    private final String token;

    public JwtToken(String token) {
        this.token = token;
    }

    @Override
    public Object getPrincipal() {
        return JwtUtil.getClaim(token, JwtUtil.ACCOUNT);
    }

    @Override
    public Object getCredentials() {
        return token;
    }
}
